﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Diagnostics;
using System.Reflection;
using System.Collections; 
using System.Web.UI;
using LigerMVC.Common;

namespace LigerMVC.Common.Extensions
{
    /// <summary>
    /// 扩展方法
    /// </summary>
    public static class BoolExtension
    {   
        public static int ToInt32(this bool value)
        {
            return value ? 1 : 0;
        }

        public static short ToShort(this bool value)
        {
            return (short)(value ? 1 : 0);
        }


        public static int ToInt32(this bool? value)
        {
            if (value == null) return 0;
            return value.Value ? 1 : 0;
        }

        public static short ToShort(this bool? value)
        {
            if (value == null) return 0;
            return (short)(value.Value ? 1 : 0);
        }
    }

            
}
